import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { StepVO, StepForm, StepQuery } from '@/leadmall/api/step/types';

/**
 * 查询阶段步骤列表
 * @param query
 * @returns {*}
 */

export const listStep = (query?: StepQuery): AxiosPromise<StepVO[]> => {
  return request({
    url: PORT +'/leadmall/step/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询阶段步骤详细
 * @param id
 */
export const getStep = (id: string | number): AxiosPromise<StepVO> => {
  return request({
    url: PORT +'/leadmall/step/' + id,
    method: 'get'
  });
};

/**
 * 新增阶段步骤
 * @param data
 */
export const addStep = (data: StepForm) => {
  return request({
    url: PORT +'/leadmall/step',
    method: 'post',
    data: data
  });
};

/**
 * 修改阶段步骤
 * @param data
 */
export const updateStep = (data: StepForm) => {
  return request({
    url: PORT +'/leadmall/step',
    method: 'put',
    data: data
  });
};

/**
 * 删除阶段步骤
 * @param id
 */
export const delStep = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/step/' + id,
    method: 'delete'
  });
};
